import 'package:finance_app/src/entities/chat_room_member_entity.dart';

chatRoomMemberEntityFromJson(ChatRoomMemberEntity data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id'] is String
				? int.tryParse(json['id'])
				: json['id'].toInt();
	}
	if (json['name'] != null) {
		data.name = json['name'].toString();
	}
	if (json['nickname'] != null) {
		data.nickname = json['nickname'].toString();
	}
	if (json['email'] != null) {
		data.email = json['email'].toString();
	}
	if (json['country_code'] != null) {
		data.countryCode = json['country_code'].toString();
	}
	if (json['phone_number'] != null) {
		data.phoneNumber = json['phone_number'].toString();
	}
	if (json['locale'] != null) {
		data.locale = json['locale'].toString();
	}
	if (json['timezone'] != null) {
		data.timezone = json['timezone'].toString();
	}
	if (json['avatar'] != null) {
		data.avatar = json['avatar'].toString();
	}
	if (json['default_company_id'] != null) {
		data.defaultCompanyId = json['default_company_id'] is String
				? int.tryParse(json['default_company_id'])
				: json['default_company_id'].toInt();
	}
	if (json['email_verified_at'] != null) {
		data.emailVerifiedAt = json['email_verified_at'].toString();
	}
	if (json['notification_token'] != null) {
		data.notificationToken = json['notification_token'];
	}
	if (json['enabled'] != null) {
		data.enabled = json['enabled'] is String
				? int.tryParse(json['enabled'])
				: json['enabled'].toInt();
	}
	if (json['created_at'] != null) {
		data.createdAt = json['created_at'].toString();
	}
	if (json['updated_at'] != null) {
		data.updatedAt = json['updated_at'].toString();
	}
	if (json['deleted_at'] != null) {
		data.deletedAt = json['deleted_at'];
	}
	return data;
}

Map<String, dynamic> chatRoomMemberEntityToJson(ChatRoomMemberEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['nickname'] = entity.nickname;
	data['email'] = entity.email;
	data['country_code'] = entity.countryCode;
	data['phone_number'] = entity.phoneNumber;
	data['locale'] = entity.locale;
	data['timezone'] = entity.timezone;
	data['avatar'] = entity.avatar;
	data['default_company_id'] = entity.defaultCompanyId;
	data['email_verified_at'] = entity.emailVerifiedAt;
	data['notification_token'] = entity.notificationToken;
	data['enabled'] = entity.enabled;
	data['created_at'] = entity.createdAt;
	data['updated_at'] = entity.updatedAt;
	data['deleted_at'] = entity.deletedAt;
	return data;
}